package mapper;

import model.Course;
import model.Score;
import model.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ScoreMapper {


    @Select("select * from score where student_id=#{student_id}")
    @Results({
            @Result(column = "course_id",property = "course",javaType = Course.class,
                    one = @One(select = "mapper.CourseMapper.selectByPrimaryKey")),
    })

    public List<Score> getScoreByStudentId(int student_id);
    @Select("select * from score")
    @Results({
            @Result(column = "course_id",property = "course",javaType = Course.class,
                    one = @One(select = "mapper.CourseMapper.selectByPrimaryKey")),
            @Result(column = "student_id",property = "student",javaType = Student.class,
                    one = @One(select = "mapper.StudentMapper.getById"))
    })

    List<Score> findAll();
}
